﻿@page "/SysDevice/Details/{id}"
@using SelfService.ViewModel.SysDeviceVMs;
@inherits BasePage

<ValidateForm @ref="vform" Model="@_model" >
    <Row ItemsPerRow="ItemsPerRow.Two" RowType="RowType.Normal">
        <Display @bind-Value="@_model.Entity.Name"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.Model"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.Description"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.IsSwallow"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.Mode"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.GroupId" Lookup="@AllSysDeviceGroups"  ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.Port"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.DllName"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.DllClass"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.DllWorkSpace"   ShowLabel="true"/>
            <Display @bind-Value="@_model.Entity.IsEnable"   ShowLabel="true"/>
    </Row>
    <div class="modal-footer table-modal-footer">
        <Button Color="Color.Primary" Icon="fa fa-save" Text="@WtmBlazor.Localizer["Sys.Close"]" OnClick="OnClose"></Button>
    </div>
</ValidateForm>

@code {

    private SysDeviceVm _model = null;
    private ValidateForm vform { get; set; }
    [Parameter]
    public string id { get; set; }

    private List<SelectedItem> AllSysDeviceGroups = new List<SelectedItem>();


    protected override async Task OnInitializedAsync()
    {

        AllSysDeviceGroups = await WtmBlazor.Api.CallItemsApi("/api/SysDevice/GetSysDeviceGroups", placeholder: WtmBlazor.Localizer["Sys.All"]);

        var rv = await WtmBlazor.Api.CallAPI<SysDeviceVm>($"/api/SysDevice/{id}");
        _model = rv.Data;
    }

    public void OnClose()
    {
        CloseDialog();
    }

}
